package com.lingx.model.impl.interpreter;

import org.springframework.stereotype.Component;

import com.lingx.model.IContext;
import com.lingx.model.IPerformer;
import com.lingx.model.impl.AbstractInterpreter;

/** 
* @author www.lingx.com
* @version 创建时间：2021年8月9日 下午3:39:32 
* 类说明 
*/
@Component
public class PercentageIntegerpreter extends AbstractInterpreter{

	private static final long serialVersionUID = -2869954384103649885L;

	public PercentageIntegerpreter() {
		super("PercentageIntegerpreter","百分比解释器[外]");
	}
	@Override
	public Object input(Object value) throws Exception {
		return value;
	}

	@Override
	public Object output(Object value) throws Exception {
		if(value==null)return value;
		int temp=Integer.parseInt(value.toString());
		String str="";
		if(temp<50){
			str="<span style='color:red'>"+temp+"%</span>";
		}else if(temp<80){
			str="<span style='color:orange'>"+temp+"%</span>";
		}else {
			str="<span style='color:green'>"+temp+"%</span>";
		}
		return str;
	}

}
